package models

// 优惠码活动
type MaCouponBatch struct {
	ID                  string  `gorm:"primaryKey;column:id;autoIncrement;type:bigint unsigned;not null;comment:唯一ID" json:"id" json_old:"ID"`
	Name                string  `gorm:"column:name;type:varchar(60);not null;comment:优惠码活动名称" json:"name"`
	Remark              string  `gorm:"column:remark;type:varchar(60);not null;comment:优惠码内部备注" json:"remark"`
	Type                int     `gorm:"column:type;type:tinyint(1);not null;comment:优惠码类型1 通用码2一人一码" json:"type"`
	Status              int     `gorm:"column:status;type:tinyint(1);not null;default:1;comment:优惠码状态 1正常2失效" json:"status"`
	Total               int     `gorm:"column:total;type:int(10);not null;default:0;comment:发放总量" json:"total"`
	Used                int     `gorm:"column:used;type:int(10);not null;default:0;comment:优惠码已使用数量" json:"used"`
	StartTime           int     `gorm:"column:start_time;type:bigint;not null;comment:开始时间" json:"start_time"`
	EndTime             int     `gorm:"column:end_time;type:bigint;not null;comment:结束时间" json:"end_time"`
	OrderAmountRequired int     `gorm:"column:order_amount_required;type:tinyint(1);default:2;not null;comment:是否有使用门槛:1 无使用门槛 2 需要消费满多少 " json:"order_amount_required"`
	OrderAmount         float64 `gorm:"column:order_amount;type:decimal(10,2);default:0.00;not null;comment:消费金额满多少可以打折或者满减" json:"order_amount"`
	Discount            float64 `gorm:"column:discount;type:decimal(10,2);default:0.00;comment:打折的折扣 " json:"discount"`
	Reduce              float64 `gorm:"column:reduce;type:decimal(10,2);default:0.00;comment:满减的金额" json:"reduce"`
	Desc                string  `gorm:"column:desc;type:text;comment:活动描述" json:"desc"`
	TotalTimes          int     `gorm:"column:total_times;type:int;default:-1;comment:优惠码可复用次数,默认-1无限次数" json:"total_times"`
	LikeCode            string  `gorm:"column:like_code;type:string;default:'';comment:通用码" json:"like_code"`
	SelectedGoods       string  `gorm:"column:selected_goods;type:text;;comment:选择适用商品" json:"selected_goods"`
	CreatedAt           int64   `gorm:"column:created_at;autoCreateTime;type:int;size:64;comment:创建时间" json:"created_at"`
	UpdatedAt           int64   `gorm:"column:updated_at;autoUpdateTime;type:int;size:64;comment:修改时间" json:"updated_at"`
	DeletedAt           int64   `gorm:"column:deleted_at;type:int;size:64;default:0;comment:删除时间" json:"deleted_at"`
}

func (m MaCouponBatch) TableName() string {
	return "ma_coupon_batch"
}
